/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.logikas.hipokrates.server.domain.hl7;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author csrinaldi
 */
@Entity
@Table(name = "Hl7Entity")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Hl7Entity.findAll", query = "SELECT h FROM Hl7Entity h"),
    @NamedQuery(name = "Hl7Entity.findById", query = "SELECT h FROM Hl7Entity h WHERE h.id = :id"),
    @NamedQuery(name = "Hl7Entity.findByName", query = "SELECT h FROM Hl7Entity h WHERE h.name = :name")})
public class Hl7Entity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "hl7Entity")
    private Hl7LivingSubject hl7LivingSubject;

    public Hl7Entity() {
    }

    public Hl7Entity(Long id) {
        this.id = id;
    }

    public Hl7Entity(Long id, String name) {
        this.id = id;
        this.name = name;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Hl7LivingSubject getHl7LivingSubject() {
        return hl7LivingSubject;
    }

    public void setHl7LivingSubject(Hl7LivingSubject hl7LivingSubject) {
        this.hl7LivingSubject = hl7LivingSubject;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Hl7Entity)) {
            return false;
        }
        Hl7Entity other = (Hl7Entity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.logikas.hipokrates.server.domain.hl7.Hl7Entity[ id=" + id + " ]";
    }
    
}
